//
// Source code recreated from a .class file by IntelliJ IDEA
// (powered by FernFlower decompiler)
//

package 力扣.题库.未分类;

public class demo_367 {
    public demo_367() {
    }

    public boolean isPerfectSquare(int num) {
        int left = 0;
        int right = num;
        int mid = 0;

        while(left <= right) {
            mid = (left + right) / 2;
            if ((long)mid * (long)mid == (long)num) {
                return true;
            }

            if ((long)mid * (long)mid < (long)num) {
                left = mid + 1;
            } else if ((long)mid * (long)mid > (long)num) {
                right = mid - 1;
            }
        }

        return false;
    }
}
